<%--
  Created by IntelliJ IDEA.
  User: 28101
  Date: 2021/9/16
  Time: 11:12
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <script src="/js/jquery-3.3.1.min.js"></script>
    <title>index</title>
    <style>
        .pagediv{
            height: 700px;
        }

        .lunbo{
            height: 440px;
            width: 800px;
            margin-left: 540px;
            margin-top: 10px;
        }
    </style>
</head>

<body style="background-color: rgba(217,216,210,0.33)">

    <div style="height: 50px;background-color: rgba(250, 235, 215, 0.57)">
        <table style="position:relative; left:260px; top:15px;margin-left: 500px">
            <tr>
                <td width="60px" align="center" class="loginbtn">主页</td>
                <td width="200px"></td>
                <td width="200px" align="center" class="shopcartbtn">购物车</td>
                <td width="200px" align="center" class="mycartbtn">我的订单</td>

                <jstl:if test="${user != null}">
                    <div hidden="hidden">${user.uid }</div>
                    <td width="300px" align="center" hidden="hidden">
                            ${user.uid }
                    </td>
                    <td>
                            ${user.name }
                    </td>
                </jstl:if>

                <jstl:if test="${user == null}">
                    <td class="login">
                        登录
                    </td>
                </jstl:if>
            </tr>
        </table>
    </div>

    <div class="lunbo">

        <div id="lunbo" class="indexdiv"></div>

    </div>

    <div class="pagediv">
        <div style="margin-left: 140px;font-size: 30px;width: 500px">
            手机
        </div>

        <div id="page1" class="indexdiv"></div>
    </div>

    <div class="pagediv">
        <div style="margin-left: 140px;font-size: 30px;width: 500px">
            家电
        </div>

        <div id="page2" class="indexdiv"></div>
    </div>

    <div class="pagediv">
        <div style="margin-left: 140px;font-size: 30px;width: 500px">
            智能
        </div>

        <div id="page3" class="indexdiv"></div>
    </div>

    <script>
        $("#page1").load("phoneindex.jsp");
        $("#page2").load("homeApplianceIndex.jsp");
        $("#page3").load("smartindex.jsp");
        $("#lunbo").load("/CommodityServlet?method=lunboCommodity");

        $(".login").click(function () {
            window.location.href = "jsp/login.jsp";
        });

        $(".logoutbtn").click(function () {
            if (confirm("确定要注销吗？")){
                window.location.href = "";
            }
        });

        $(".loginbtn").click(function () {
            window.location.href = "/index.jsp";
        })

        $(".shopcartbtn").click(function () {
            window.location.href = "/jsp/shoppingCustom.jsp";
        })

        $(".mycartbtn").click(function () {
            window.location.href = "/HisShoppingCustomServlet?method=getUserHisShoppingCustom";
        })

    </script>
</body>

</html>
